package com.foreveross.bsl.mam.app.application.impl;

import java.util.ArrayList;
import java.util.List;

import javax.inject.Inject;
import javax.inject.Named;

import com.foreveross.bsl.common.utils.bean.BeanHelper;
import com.foreveross.bsl.mam.app.application.AppCategoryApplication;
import com.foreveross.bsl.mam.app.application.SettingCategoryApplication;
import com.foreveross.bsl.mam.app.application.vo.AppCategoryVo;
import com.foreveross.bsl.mam.app.application.vo.SettingCategoryVo;

/**
 * 应用类别实体方法的实现
 * 
 * @author tanzhixiong
 * @2013-6-21 @下午4:41:43
 */
@Named("appCategoryApplication")
public class AppCategoryApplicationImpl implements AppCategoryApplication {

	@Inject
	private SettingCategoryApplication settingCategoryApplication;

	@Override
	public AppCategoryVo getEntity(String id) {
		SettingCategoryVo settingvo = this.settingCategoryApplication.getEntity(id);
		if (settingvo != null) {
			AppCategoryVo vo = new AppCategoryVo();
			BeanHelper.copyProperties(vo, settingvo);
			return vo;
		}
		return null;
	}

	@Override
	public List<AppCategoryVo> findAll() {
		List<SettingCategoryVo> list = this.settingCategoryApplication.findByType("1", "1"); // 获取all应用类别 
		List<AppCategoryVo> result = new ArrayList<AppCategoryVo>();
		if (list != null) {
			AppCategoryVo vo;
			for (SettingCategoryVo settingvo : list) {
				vo = new AppCategoryVo();
				BeanHelper.copyProperties(vo, settingvo);
				result.add(vo);
			}
		}
		return result;
	}
}
